package com.pro.springbootpro.utils;

import com.pro.springbootpro.enums.ResponseEnum;
import lombok.Builder;
import lombok.Data;

/**
 * @author DJR (1210843430@qq.com)
 */
@Data
@Builder
public class ResultVo {
    private String code;
    private String msg;
    private Object data;


    /**
     *
     * @param data
     * @return
     */
    public static ResultVo success(Object data){
        return new ResultVoBuilder().code(ResponseEnum.SUCCESS.getCode()).data(data).msg("success").build();
    }

    /**
     *
     * @return
     */
    public static ResultVo success(){
        return new ResultVoBuilder().code(ResponseEnum.SUCCESS.getCode()).msg("success").build();
    }

    /**
     *
     * @return
     */
    public static ResultVo fail(){
        return new ResultVoBuilder().code(ResponseEnum.FAIL.getCode()).msg("fail").build();
    }
}
